
#include <mockcpp/mockcpp.hpp>
#include <testngpp/testngpp.hpp>
#include <Rectangle.h>

USING_MOCKCPP_NS
USING_TESTNGPP_NS

FIXTURE(FixedRectangle)
{
	TEST(Should be able to caculate the area of a rectangle - width 2, hight 3, area = 6)
	{
		Rectangle rectangle(2,3);
		ASSERT_EQ(6, rectangle.getArea());
	}

	TEST(Should be able to caculate the perimeter of a rectangle - width 2, hight 3, perimeter = 10)
	{
		Rectangle rectangle(2,3);
		ASSERT_EQ(10, rectangle.getPerimeter());
	}

};

FIXTURE(AlterableRectangle)
{
        Rectangle* pRectangle;

	SETUP()
	{
		pRectangle = new Rectangle(2,3);
	}

	TEARDOWN()
	{
		delete pRectangle;
	}

	TEST(Should be able to caculate the area of a rectangle after changing width- width 2->10, hight 3, area = 30)
	{
                pRectangle->setWidth(10);
		ASSERT_EQ(30, pRectangle->getArea());
	}

	TEST(Should be able to caculate the area of a rectangle after changing hight- width 2, height 3->20, area = 40)
	{
                pRectangle->setHeight(20);
		ASSERT_EQ(40, pRectangle->getArea());
	}

	TEST(Should be able to caculate the area of a rectangle after changing width and hight- width 2->10, height 3->20, area = 200)
	{
                pRectangle->setWidth(10);
                pRectangle->setHeight(20);
		ASSERT_EQ(200, pRectangle->getArea());
	}

	TEST(Should be able to caculate the perimeter of a rectangle after changing width- width 2->10, hight 3, perimeter = 26)
	{
                pRectangle->setWidth(10);
		ASSERT_EQ(26, pRectangle->getPerimeter());
	}

	TEST(Should be able to caculate the perimeter of a rectangle after changing hight- width 2, height 3->20, perimeter = 44)
	{
                pRectangle->setHeight(20);
		ASSERT_EQ(44, pRectangle->getPerimeter());
	}

	TEST(Should be able to caculate the perimeter of a rectangle after changing width and hight- width 2->10, height 3->20, perimeter = 60)
	{
                pRectangle->setWidth(10);
                pRectangle->setHeight(20);
		ASSERT_EQ(60, pRectangle->getPerimeter());
	}

};
